package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.BdmMemberLevel;
import com.ruoyi.system.mapper.BdmMemberLevelMapper;
import com.ruoyi.system.service.IBdmMemberLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 会员等级Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-07
 */
@Service
public class BdmMemberLevelServiceImpl extends ServiceImpl<BdmMemberLevelMapper,BdmMemberLevel> implements IBdmMemberLevelService
{
    @Autowired
    private BdmMemberLevelMapper bdmMemberLevelMapper;

    /**
     * 查询会员等级
     * 
     * @param id 会员等级主键
     * @return 会员等级
     */
    @Override
    public BdmMemberLevel selectBdmMemberLevelById(Long id)
    {
        return bdmMemberLevelMapper.selectBdmMemberLevelById(id);
    }

    /**
     * 查询会员等级列表
     * 
     * @param bdmMemberLevel 会员等级
     * @return 会员等级
     */
    @Override
    public List<BdmMemberLevel> selectBdmMemberLevelList(BdmMemberLevel bdmMemberLevel)
    {
        return bdmMemberLevelMapper.selectBdmMemberLevelList(bdmMemberLevel);
    }

    /**
     * 新增会员等级
     * 
     * @param bdmMemberLevel 会员等级
     * @return 结果
     */
    @Override
    public int insertBdmMemberLevel(BdmMemberLevel bdmMemberLevel)
    {
        bdmMemberLevel.setCreateUser(SecurityUtils.getUserId());
        bdmMemberLevel.setCreateTime(DateUtils.getNowDate());
        return bdmMemberLevelMapper.insertBdmMemberLevel(bdmMemberLevel);
    }

    /**
     * 修改会员等级
     * 
     * @param bdmMemberLevel 会员等级
     * @return 结果
     */
    @Override
    public int updateBdmMemberLevel(BdmMemberLevel bdmMemberLevel)
    {
        bdmMemberLevel.setUpdateUser(SecurityUtils.getUserId());
        bdmMemberLevel.setUpdateTime(DateUtils.getNowDate());
        return bdmMemberLevelMapper.updateBdmMemberLevel(bdmMemberLevel);
    }

    /**
     * 批量删除会员等级
     * 
     * @param ids 需要删除的会员等级主键
     * @return 结果
     */
    @Override
    public int deleteBdmMemberLevelByIds(Long[] ids)
    {
        return bdmMemberLevelMapper.deleteBdmMemberLevelByIds(ids);
    }

    /**
     * 删除会员等级信息
     * 
     * @param id 会员等级主键
     * @return 结果
     */
    @Override
    public int deleteBdmMemberLevelById(Long id)
    {
        return bdmMemberLevelMapper.deleteBdmMemberLevelById(id);
    }
}
